<template>
	<view class="page">
		<view class="row">
			<view class="tipsLabel">
				第一位家长信息
			</view>
		</view>
		<view class="row">
			<view class="label">
				家长姓名:
			</view>
			<view class="input">
				<u-input type="number" v-model="form.parentName1" placeholder="请输入家长姓名"></u-input>
			</view>
		</view>
		<view class="row">
			<view class="label">
				电话号码:
			</view>
			<view class="input">
				<u-input type="number" v-model="form.mobilePhone1" placeholder="请输入电话号码"></u-input>
			</view>
		</view>
		<view class="row">
			<view class="tipsLabel">
				第二位家长信息
			</view>
		</view>
		<view class="row">
			<view class="label">
				家长姓名:
			</view>
			<view class="input">
				<u-input type="number" v-model="form.parentName2" placeholder="请输入第二位家长"></u-input>
			</view>
		</view>
		<view class="row">
			<view class="label">
				电话号码:
			</view>
			<view class="input">
				<u-input type="number" v-model="form.mobilePhone2" placeholder="请输入电话号码"></u-input>
			</view>
		</view>
		<view class="row">
			<view class="tipsLabel">
				第三位家长信息
			</view>
		</view>
		<view class="row">
			<view class="label">
				家长姓名:
			</view>
			<view class="input">
				<u-input type="number" v-model="form.parentName3" placeholder="请输入第三位家长"></u-input>
			</view>
		</view>
		<view class="row">
			<view class="label">
				电话号码:
			</view>
			<view class="input">
				<u-input type="number" v-model="form.mobilePhone3" placeholder="请输入电话号码"></u-input>
			</view>
		</view>
		
		<view class="btn" @click="handleConfirm">
			确定
		</view>
		
	</view>
</template>

<script>
	import {familyLoveinfoUpdateApi,getFamilyLoveinfoApi} from '@/common/api/commonApi/commonApi.js'
	export default {
		data() {
			return {
				form:{
					parentName1 : '',
					mobilePhone1 : '',
					parentName2 : '',
					mobilePhone2 : '',
					parentName3 : '',
					mobilePhone3 : '',
					memberId : '',
				},
				
			}
		},
		methods: {
			handleConfirm(){
				let bool1 = uni.$u.test.mobile(this.form.mobilePhone1)
				let bool2 = uni.$u.test.mobile(this.form.mobilePhone2)
				let bool3 = uni.$u.test.mobile(this.form.mobilePhone3)
				if(!bool1 || !bool2 || !bool3) return this.setMessage('请输入正确的手机号码')
				familyLoveinfoUpdateApi(this.form).then(res=>{
					this.setMessage('设置成功！')
					setTimeout(()=>{
						this.goBack()
					},1500)
				})
			},
			getInfo(){
				getFamilyLoveinfoApi(this.form.memberId).then(res=>{
					this.form = res.data
				})
			}
			
		},
		onLoad() {
			let info = uni.getStorageSync('selectInfoAccount')
			this.form.memberId = info.id
			this.getInfo()
		},
		onShow() {
			
		},
	}
</script>

<style lang="scss" scoped>
.page{
	background-color: #fff;
	height: 100vh;
	.text{
		color: #333;
	}
	.row{
		display: flex;
		align-items: center;
		height: 90rpx;
		padding: 0 30rpx;
		border-bottom: 2rpx solid #dcdcdc;
		&:nth-child(1){
			border-top: 2rpx solid #dcdcdc;
		}
		.label{
			width: 220rpx;
			color: #000;
		}
		.tipsLabel{
			color: #c8c8c8;
		}
		.input{
			flex: 1;
			height: 100%;
			display: flex;
			align-items: center;
			.getCodeBtn{
				background-color: #4089f0;
				@include flexCenter;
				color: #fff;
				border-radius: 40rpx;
				height: 52rpx;
				width: 182rpx;
			}
		}
		
	}
	.btn{
		margin: 20rpx auto 0;
		background: #2d8cf6;
		@include flexCenter;
		width: 90vw;
		height: 92rpx;
		border-radius: 10rpx;
		color: #fff;
	}
	
}
</style>
